package com.example.easyexcel.enums;

import org.springframework.util.StringUtils;

public enum TableCodeEnum {
    STU_INFO("si", "stu_info");

    TableCodeEnum(String tableCode, String tableName) {
        this.tableCode = tableCode;
        this.tableName = tableName;
    }

    private final String tableCode;
    private final String tableName;

    public static String getNameByCode(String tableCode) {
        if (StringUtils.hasText(tableCode)) {
            for (TableCodeEnum tableCodeEnum : TableCodeEnum.values()) {
                if (tableCode.equals(tableCodeEnum.getTableCode())) {
                    return tableCodeEnum.getTableName();
                }
            }
        }
        return "";
    }

    public String getTableCode() {
        return tableCode;
    }

    public String getTableName() {
        return tableName;
    }
}
